package com.itdachang.design.behavioral.iterator;

/**
 * @author gcq
 * @create 2022-02-16
 */
public class MainTest {
    public static void main(String[] args) {
        MaYunCheng cheng = new MaYunCheng();

        cheng.likeYou("张三");
        cheng.likeYou("李四");
        cheng.likeYou("王五");

        BeautifuMan.Itr iterator = cheng.getIterator();
        String s = iterator.firstLove();
        System.out.println("初恋" + s);

        String current = iterator.current();
        System.out.println("现任" + current);

        System.out.println("===========");
        while (iterator.haxNext()) {
            String next = iterator.next();
            System.out.println(next);
        }

    }
}